(insert-image-file): When visiting an image, suppress the cursor in the
authorMiles Bader <miles@gnu.org>
Fri, 2 Feb 2001 13:09:42 +0000 (13:09 +0000)
committerMiles Bader <miles@gnu.org>
Fri, 2 Feb 2001 13:09:42 +0000 (13:09 +0000)
image buffer.

lisp/image-file.el

index 87314f3b90ca03acdcf3eda37fd5d88ded42e678..afee88d1346326eec5fed7a1da90944da2eddff8 100644 (file)
@@ -110,6 +110,7 @@ the command `insert-file-contents'."
     (when (and (or (null beg) (zerop beg)) (null end))
       (let* ((ibeg (point))
             (iend (+ (point) (cadr rval)))
+            (visitingp (and visit (= ibeg (point-min)) (= iend (point-max))))
             (data
              (string-make-unibyte
               (buffer-substring-no-properties ibeg iend)))
@@ -122,11 +123,13 @@ the command `insert-file-contents'."
                        ;; This a cheap attempt to make the whole buffer
                        ;; read-only when we're visiting the file (as
                        ;; opposed to just inserting it).
-                       ,@(and visit
-                              (= ibeg (point-min))
-                              (= iend (point-max))
+                       ,@(and visitingp
                               '(read-only t front-sticky (read-only))))))
-       (add-text-properties ibeg iend props)))
+       (add-text-properties ibeg iend props)
+       (when visitingp
+         ;; Inhibit the cursor when the buffer contains only an image,
+         ;; because cursors look very strange on top of images.
+         (setq cursor-type nil))))
     rval))
 
 (defun image-file-handler (operation &rest args)